function addOrUpdVoucherOrderPicture(orderId, title) {
	
	var addOrUpdVoucherOrderPictureForm = new Ext.form.FormPanel({
		id : 'addOrUpdVoucherOrderPictureForm',
		frame : true,
		layout : "form",
		buttonAlign : 'center',
		labelWidth : 120,
		monitorValid : true,
		bodyBorder : false,
		fileUpload : true,// 上传文件设置为true
		reader : new Ext.data.JsonReader({
					success : 'success',
					root : 'data'
				}, [{
						name : 'id'
						}, {
						name : 'deliveryPicture'
						}]),
		items : [{
			layout : 'column',
			border : false,
			items : [{
				columnWidth : .70,
				layout : 'form',
				border : false,
				defaults : {
					labelStyle : "text-align:right"
				},
				items : [{
							id : 'orderPictureId',
							xtype : 'hidden',
							name : 'id'
						},{
							id : 'vaFrom_upload',
							fieldLabel : "<span style='color:#F00'>*</span>导入确认发货图片",
							name : 'upload',
							xtype : 'fileuploadfield',
							editable : false,
							buttonText : '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;浏览&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
							blankText : "请选择您要导入的图片",
							anchor : '100%',
							border : false,
							listeners : {
								'fileselected' : function(field, value) {
									var uploadImage = Ext.getCmp("vaFrom_upload");
									var img_reg = /\.([jJ][pP][gG]){1}$|\.([jJ][pP][eE][gG]){1}$|\.([gG][iI][fF]){1}$|\.([pP][nN][gG]){1}$|\.([bB][mM][pP]){1}$/;
									// 得到选择的图片路径
									var url = 'file://' + uploadImage.getValue();
									if (img_reg.test(url)) {
										var imageShow_box = Ext.getCmp("vaForm_image"); // 预览的图片框对象
										if (Ext.isIE) {
											var imageShow_box_dom = imageShow_box
													.getEl().dom;
											imageShow_box_dom.src = Ext.BLANK_IMAGE_URL;// 覆盖原来的图片
											imageShow_box_dom.filters
													.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;
										}// 支持FF
										else {
											var f = document
													.getElementById("vaFrom_upload-file").files[0];
											Ext.get('vaForm_image').dom.src = window.URL
													.createObjectURL(f);
										}
									} else {
										Ext.MessageBox.show({
													title : "错误提示",
													msg : "必须为图片格式",
													buttons : Ext.MessageBox.OK,
													icon : Ext.MessageBox.ERROR
												});
									}

						}
					}
				}]
			}]

		}, {
			layout : 'column',
			border : false,
			items : [{
				columnWidth : .99,
				layout : 'form',
				border : false,
				style : {
					"textAlign" : 'center'
				},
				items : [{
					// 预览图片
					xtype : 'box',
					align : 'center',
					baseCls : "x-plain",
					id : 'vaForm_image',
					autoEl : {
						width : 300,
						height : 200,
						tag : 'input',
						type : 'image',
						src : __ctxPath + "/images/monmonde.png",
						style : 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:160px;height:160px;marginTop : "50px",',
						onclick : 'clickHandler()',
						complete : 'off'
					}
				}]
			}]
		}],
		buttons : [{
					id : 'addOrUpdOrderPictureCommit',
					text : '确定',
					formBind : true,
					handler : function() {
						insertOrUpdOrderPicture();
					}
				}, {
					text : "取消",
					handler : function() {
						addOrUpdVoucherOrderPictureWindow.close();
					}
				}]
	});
	var addOrUpdVoucherOrderPictureWindow = new Ext.Window({
				id : 'addOrUpdVoucherOrderPictureWindow',
				closeAction : 'close',
				title : title,
				closable : true,
				plain : true,
				draggable : false, // 不可拖动
				// resizable : false, // 不可调整
				modal : true,
				width : 590,
				height : 340,
				buttonAlign : 'center',
				autoDestroy : true,
				layout : 'fit',
				items : [addOrUpdVoucherOrderPictureForm],
				listeners : {
					'show' : function() {
						selectorderId(orderId);
					},
					'beforeshow' : function() {
						addOrUpdVoucherOrderPictureWindow.center();
					}
				}
			});
	return addOrUpdVoucherOrderPictureWindow;
}

/**
 * 广告突变点击事件
 */
function clickHandler() {
	var imageShow_box = Ext.getCmp("vaForm_image");
	var subjectPicPath = imageShow_box.getEl().dom.src;
	window.open(subjectPicPath, '_blank');
}

/**
 * 添加或修改广告
 */
function insertOrUpdOrderPicture() {
	var advertForm = Ext.getCmp("addOrUpdVoucherOrderPictureForm");
	var orderPictureId = Ext.getCmp("orderPictureId").getValue();
	console.log(orderPictureId);
	var uploadImage = Ext.getCmp("vaFrom_upload").getValue();
	if (uploadImage == '') {
		Ext.Msg.show({
					title : '提示信息',
					msg : '确认发货图片不能为空!',
					buttons : Ext.MessageBox.OK,
					icon : Ext.MessageBox.WARNING
				});
		return;
	}
	if (advertForm.getForm().isValid()) {
		Ext.Msg.confirm("提示框", "确认保存确认发货图片吗？", function(button) {
					if (button == "yes") {
						advertForm.getForm().submit({
							url : __ctxPath
									+ '/voucherManager/insertVoucherOrderPicture',
							waitTitle : "请稍候",
							waitMsg : "正在提交表单，请稍候......",
							failure : function(response, options) {
								var jsonData = Ext.util.JSON
										.decode(options.response.responseText);
								Ext.MessageBox.show({
											title : "错误提示",
											msg : jsonData.data,
											buttons : Ext.MessageBox.OK,
											icon : Ext.MessageBox.ERROR
										});
							},
							success : function(response, options) {
								var jsonData = Ext.util.JSON
										.decode(options.response.responseText);
								Ext.MessageBox.show({
											title : "提示信息",
											msg : jsonData.data,
											buttons : Ext.MessageBox.OK,
											icon : Ext.MessageBox.INFO
										});
								Ext.getCmp("addOrUpdVoucherOrderPictureWindow").close();
								var gridPanel = Ext.getCmp("voucherOrderPictureManagerGrid");
								if (typeof(gridPanel) != 'undefined') {
									gridPanel.store.reload();
								}
							}
						});

					}

				});
	}
}

/**
 * 查询广告信息
 * 
 * @param {}
 *            subjectId
 */
function selectorderId(orderId) {
	if (orderId != null && orderId != "undefined") {

		Ext.getCmp("addOrUpdVoucherOrderPictureForm").getForm().load({
			deferredRender : false,
			url : __ctxPath + "/voucherManager/findVoucherOrderById",
			params : {
				orderId : orderId
			},
			waitTitle : "请稍候",
			waitMsg : "正在载入数据...",
			root : "data",
			success : function(response, options) {
				var data = options.result.data;
				

			}

		});
	}
}
